]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
extensions-app: Remember window state
authorFlorian Müllner <fmuellner@gnome.org>
Sat, 13 Jan 2024 22:34:00 +0000 (23:34 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Sat, 13 Jan 2024 22:44:35 +0000 (23:44 +0100)
It's good practice to save and reload the window size and
maximization state, and easy enough to implement, so let's
do that.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3115>

subprojects/extensions-app/data/meson.build
subprojects/extensions-app/data/org.gnome.Extensions.gschema.xml [new file with mode: 0644]
subprojects/extensions-app/data/ui/extensions-window.ui
subprojects/extensions-app/js/extensionsWindow.js
subprojects/extensions-app/meson.build

index 4f24267b04a634f14a0eb14bd2f6988a8b331a19..367c56d285a3e50542a4dc4c4a38875e6a1f9280 100644 (file)
@@ -48,3 +48,5 @@ configure_file(
 
 subdir('icons')
 subdir('metainfo')
+
+install_data(base_id + '.gschema.xml', install_dir: schemadir)
diff --git a/subprojects/extensions-app/data/org.gnome.Extensions.gschema.xml b/subprojects/extensions-app/data/org.gnome.Extensions.gschema.xml
new file mode 100644 (file)
index 0000000..d88bb87
--- /dev/null
@@ -0,0 +1,17 @@
+<?<?xml version="1.0" encoding="UTF-8"?>
+<schemalist>
+  <schema path="/org/gnome/Extensions/" id="org.gnome.Extensions">
+    <key name="window-width" type="i">
+      <default>800</default>
+      <summary>Window width</summary>
+    </key>
+    <key name="window-height" type="i">
+      <default>500</default>
+      <summary>Window height</summary>
+    </key>
+    <key name="window-maximized" type="b">
+      <default>false</default>
+      <summary>Window maximized</summary>
+    </key>
+  </schema>
+ </schemalist>
index 51ce6db3fe1a14a74fe6688501352ee962be58f3..3e5116d91a11837d5aae54f4bc1294a32ed8e86d 100644 (file)
@@ -54,8 +54,6 @@
     <property name="filter">searchFilter</property>
   </object>
   <template class="ExtensionsWindow" parent="AdwApplicationWindow">
-    <property name="default-width">800</property>
-    <property name="default-height">500</property>
     <property name="title" translatable="yes">Extensions</property>
     <child>
       <object class="AdwToolbarView">
index 9b7a1519e0dd8c6f625e70cbbfc62792a5a66649..4d9cf17c99d2567b62c6e72e3b00d4a62f247443 100644 (file)
@@ -59,6 +59,20 @@ export const ExtensionsWindow = GObject.registerClass({
                 },
             }]);
 
+        const settings = new Gio.Settings({
+            schema_id: 'org.gnome.Extensions',
+        });
+
+        settings.bind('window-width',
+            this, 'default-width',
+            Gio.SettingsBindFlags.DEFAULT);
+        settings.bind('window-height',
+            this, 'default-height',
+            Gio.SettingsBindFlags.DEFAULT);
+        settings.bind('window-maximized',
+            this, 'maximized',
+            Gio.SettingsBindFlags.DEFAULT);
+
         this._searchEntry.connect('search-changed',
             () => (this._searchFilter.search = this._searchEntry.text));
         this._searchBar.connect('notify::search-mode-enabled',
index f69b110f819cb99223d6d387a515f7cbfca30951..858aa69a524c06af4b21133a9ea35a060b8a584a 100644 (file)
@@ -44,6 +44,7 @@ desktopdir = join_paths(datadir, 'applications')
 icondir = join_paths(datadir, 'icons')
 localedir = join_paths(datadir, 'locale')
 metainfodir = join_paths(datadir, 'metainfo')
+schemadir = join_paths(datadir, 'glib-2.0', 'schemas')
 servicedir = join_paths(datadir, 'dbus-1', 'services')
 
 gjs = find_program('gjs')
@@ -64,6 +65,7 @@ if not meson.is_subproject()
   subdir('po')
 
   gnome.post_install(
+    glib_compile_schemas: true,
     gtk_update_icon_cache: true
   )